package com.deductive.netty.tcp.message;

import com.fasterxml.jackson.databind.JsonNode;

/**
 * TCP通信的消息体POJO，用于替代Protobuf生成的MessageProto类。
 * 使用JSON格式进行序列化和反序列化。
 */
public class TcpMessage {

    private String type;
    private JsonNode payload;

    public TcpMessage() {
    }

    public TcpMessage(String type, JsonNode payload) {
        this.type = type;
        this.payload = payload;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public JsonNode getPayload() {
        return payload;
    }

    public void setPayload(JsonNode payload) {
        this.payload = payload;
    }

    @Override
    public String toString() {
        return "TcpMessage{" +
                "type='" + type + '\'' +
                ", payload=" + payload +
                '}';
    }
}

